********************************
*CODE TO GENERATE CONFLICT DATA********************************
*USING COORDINATES AND RADIUS FROM PRIO CONFLICT SITE DATA SET*
*Coordinates and radiuses from ConflictSite 4-2010_v3 Dataset_SAMPLE*
***************************************************************

*Note: The calculations in this file make use of the geodist package.
*ssc install geodist

*Code whether in conflict zone for all years from 1999 to 2008
*Prio Conflict Site specifies centroids and radiuses of conflict for each year

*coding distance from centroids of conflict
geodist latit longit 0.45 30.69, generate(Uganda1999)
geodist latit longit 1.76 31.44, generate(Uganda2000)
geodist latit longit 1.76 31.43, generate(Uganda2001)
geodist latit longit 2.37 32.01, generate(Uganda2002)
geodist latit longit 2.53 32.71, generate(Uganda2003)
geodist latit longit 2.65 32.97, generate(Uganda2004)
geodist latit longit 2.53 32.71, generate(Uganda2005)
geodist latit longit 2.90 32.60, generate(Uganda2006)
geodist latit longit 0.85 30.18, generate(Uganda2007)

geodist latit longit 12.68 -15.67, generate(Senegal2000)
geodist latit longit 12.76 -16.49, generate(Senegal2001)
geodist latit longit 12.72 -16.28, generate(Senegal2003)

geodist latit longit 12.09 12.90, generate(Nigeria2004a)
geodist latit longit 5.16 6.38, generate(Nigeria2004b)

*coding whether fall within conflict radius in a given year
gen conflictUganda1999 = 0 if Uganda1999>=150
replace conflictUganda1999 = 1 if Uganda1999<150

gen conflictUganda2000 = 0 if Uganda2000>=250
replace conflictUganda2000 = 1 if Uganda2000<250

gen conflictUganda2001 = 0 if Uganda2001>=250
replace conflictUganda2001 = 1 if Uganda2001<250

gen conflictUganda2002 = 0 if Uganda2002>=250
replace conflictUganda2002 = 1 if Uganda2002<250

gen conflictUganda2003 = 0 if Uganda2003>=150
replace conflictUganda2003 = 1 if Uganda2003<150

gen conflictUganda2004 = 0 if Uganda2004>=150
replace conflictUganda2004 = 1 if Uganda2004<150

gen conflictUganda2005 = 0 if Uganda2005>=150
replace conflictUganda2005 = 1 if Uganda2005<150

gen conflictUganda2006 = 0 if Uganda2006>=100
replace conflictUganda2006 = 1 if Uganda2006<100

gen conflictUganda2007 = 0 if Uganda2007>=50
replace conflictUganda2007 = 1 if Uganda2007<50

gen conflictSenegal2000 = 0 if Senegal2000>=100
replace conflictSenegal2000 = 1 if Senegal2000<100

gen conflictSenegal2001 = 0 if Senegal2001>=50
replace conflictSenegal2001 = 1 if Senegal2001<50

gen conflictSenegal2003 = 0 if Senegal2003>=50
replace conflictSenegal2003 = 1 if Senegal2003<50

gen conflictNigeria2004a = 0 if Nigeria2004a>=200
replace conflictNigeria2004a = 1 if Nigeria2004a<200

gen conflictNigeria2004b = 0 if Nigeria2004b>=100
replace conflictNigeria2004b = 1 if Nigeria2004b<100

